1. Field of the Invention
The present invention generally relates to a data protection method, and more particularly, to a data protection method for a memory.
2. Description of Related Art
Flash memories, having the advantages including non-volatility, high density, and fast response, have become an outstanding one of the many kinds of commercialized memories. However, with respect to a conventional flash memory, even only repetitive reading operations may cause variations of the data saved in the flash memory, which may further lead to an unpredictable error that the read data is inconsistent with the original data.
In order to avoid the occurrence of such an unpredictable error, error correction codes are often utilized in data protection technologies for protecting data saved in flash memories. For example, when the data saved in a flash memory is being read, the system can execute a limited error recovery to the flash memory by conducting a calculation of error correction codes at a controller end. The error recovery depends on the capability of a controller to generate error correction codes to protect data. For example, one controller may be capable of detecting and recovering 1 bit from 256 bytes, while another controller may be capable of detecting and recovering 4 bits or even 8 bits from 512 bytes.
However, even though facilitated with such error correction codes, when a flash memory has been read for a long time, it may also have the problem that the error exceeds the calculation capability of the controller. Correspondingly, a conventional technology proposes to read out the data saved in the flash memory and correct the error thereof and then rewrite the data back to the flash memory before the saved data exceeding the recovery capability of the error correction codes, so as to assure the correctness of the data saved in the flash memory. However, instant operations of data reading out, data correction, and data rewriting back to the flash memory drastically affect the speed of the system reading data from the flash memory.
Alternatively, in accordance with another conventional technology, when the system is in an idle status, the data saved in the flash memory is sequentially read out, and if there is an erroneous data detected during the reading process, the erroneous data would be corrected and thus rewritten back to the flash memory. Unfortunately, when the flash memory has a larger capacity, the time spent on scanning all data saved in the flash memory is also longer. Therefore, some erroneous data may be detected relatively late, so that the error bit number of the data exceeds the correcting capability of the error correction codes. Further, the recovery and moving operations add additional erase times of the blocks of the flash memory, thus consuming the lifetime of the blocks.
In other words, it has become a major concern of using flash memories to effectively protect the data of the flash memories, and simultaneously consider the reading speed and lifetime of the flash memories.